/*
 * Copyright {C} 2017 XRADIO TECHNOLOGY CO., LTD. All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *    1. Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *    2. Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the
 *       distribution.
 *    3. Neither the name of XRADIO TECHNOLOGY CO., LTD. nor the names of
 *       its contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES {INCLUDING, BUT NOT
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE,
 *  DATA, OR PROFITS, OR BUSINESS INTERRUPTION} HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  {INCLUDING NEGLIGENCE OR OTHERWISE} ARISING IN ANY WAY OUT OF THE USE
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __GC0328C_CFG_H__
#define __GC0328C_CFG_H__
#if 1
const uint8_t gc0328c_init_reg_tbl[][2]=
{
	// Initail Sequence Write In.

	/*init registers code.*/
	{0xfe, 0x80},
	{0xfe, 0x80},
	{0xfc, 0x16},
	{0xfc, 0x16},
	{0xfc, 0x16},
	{0xfc, 0x16},
	{0xfe, 0x00},
	{0x4f, 0x00},
	{0x42, 0x00},
	{0x03, 0x00},
	{0x04, 0xc0},
	{0x77, 0x62},
	{0x78, 0x40},
	{0x79, 0x4d},

	{0x05, 0x01},
	{0x06, 0x32},
	{0x07, 0x00},
	{0x08, 0x70},
	{0xfe, 0x01},
	{0x29, 0x00},	//anti-flicker step [11:8]
	{0x2a, 0x78},	//anti-flicker step [7:0]
	{0x2b, 0x02},	//exp level 0  20fps
	{0x2c, 0x58},
	{0x2d, 0x02},
	{0x2e, 0x58},
	{0x2f, 0x02},
	{0x30, 0x58},
	{0x31, 0x02},
	{0x32, 0x58},
	{0xfe, 0x00},

	{0xfe, 0x01},
	{0x4f, 0x00},
	{0x4c, 0x01},
	{0xfe, 0x00},
		//////////////////////////////
		 ///////////AWB///////////
		////////////////////////////////
	{0xfe, 0x01},
	{0x51, 0x80},
	{0x52, 0x12},
	{0x53, 0x80},
	{0x54, 0x60},
	{0x55, 0x01},
	{0x56, 0x06},
	{0x5b, 0x02},
	{0x61, 0xdc},
	{0x62, 0xdc},
	{0x7c, 0x71},
	{0x7d, 0x00},
	{0x76, 0x00},
	{0x79, 0x20},
	{0x7b, 0x00},
	{0x70, 0xFF},
	{0x71, 0x00},
	{0x72, 0x10},
	{0x73, 0x40},
	{0x74, 0x40},
		////AWB//
	{0x50, 0x00},
	{0xfe, 0x01},
	{0x4f, 0x00},
	{0x4c, 0x01},
	{0x4f, 0x00},
	{0x4f, 0x00},
	{0x4f, 0x00},	//wait clr finish
	{0x4d, 0x36},	  ////////////40
	{0x4e, 0x02},	  //SPL D65
	{0x4e, 0x02},	  //SPL D65
	{0x4d, 0x44},	  ////////////40
	{0x4e, 0x02},
	{0x4e, 0x02},
	{0x4e, 0x02},	  //SPL D65
	{0x4e, 0x02},	   //SPL D65
	{0x4d, 0x53},	  /////////////50
	{0x4e, 0x08},	 //SPL CWF
	{0x4e, 0x08},	   //DNP
	{0x4e, 0x02},	//04//pink		//DNP
	{0x4d, 0x63},	  /////////////60
	{0x4e, 0x08},	//TL84
	{0x4e, 0x08},	//TL84
	{0x4d, 0x73},	  //////////////80
	{0x4e, 0x20},	 //SPL	 A
	{0x4d, 0x83},	  //////////////80
	{0x4e, 0x20},	 //SPL	 A
	{0x4f, 0x01},
	{0x50, 0x88},
	{0xfe, 0x00},	  //page0
		////////////////////////////////////////////////
		////////////	 BLK	  //////////////////////
		////////////////////////////////////////////////
	{0x27, 0x00},
	{0x2a, 0x40},
	{0x2b, 0x40},
	{0x2c, 0x40},
	{0x2d, 0x40},
		//////////////////////////////////////////////
		////////// page  0	  ////////////////////////
		//////////////////////////////////////////////
	{0xfe, 0x00},
	{0x0d, 0x01},
	{0x0e, 0xe8},
	{0x0f, 0x02},
	{0x10, 0x88},
	{0x09, 0x00},
	{0x0a, 0x00},
	{0x0b, 0x00},
	{0x0c, 0x00},
	{0x16, 0x00},
	{0x17, 0x14},
	{0x18, 0x0e},
	{0x19, 0x06},
	{0x1b, 0x48},
	{0x1f, 0xC8},
	{0x20, 0x01},
	{0x21, 0x78},
	{0x22, 0xb0},
	{0x23, 0x04}, // 0x06 20140519 lanking GC0328C
	{0x24, 0x11},
	{0x26, 0x00},
	{0x50, 0x01}, //crop mode
		//global gain for range
	{0x70, 0x85},
		////////////////////////////////////////////////
		////////////	 block enable	   /////////////
		////////////////////////////////////////////////
	{0x40, 0x7f},
	{0x41, 0x26},
	{0x42, 0xff},
	{0x45, 0x00},
	{0x44, 0x02},
	{0x46, 0x03},

	{0x4b, 0x01},
	{0x50, 0x01},

		/////DN & EEINTP/////
	{0x7e, 0x0a},
	{0x7f, 0x03},
	{0x80, 0x27}, //  20140915
	{0x81, 0x15},
	{0x82, 0x90},
	{0x83, 0x02},
	{0x84, 0x23}, // 0x22 20140915
	{0x90, 0x2c},
	{0x92, 0x02},
	{0x94, 0x02},
	{0x95, 0x35},

		///////YCP
	{0xd1, 0x32},
	{0xd2, 0x32},
	{0xdd, 0x18},
	{0xde, 0x32},
	{0xe4, 0x88},
	{0xe5, 0x40},
	{0xd7, 0x0e},
		/////////////////////////////
		//////////////// GAMMA //////
		/////////////////////////////
		//rgb gamma
	{0xfe, 0x00},
	{0xbf, 0x10},
	{0xc0, 0x1c},
	{0xc1, 0x33},
	{0xc2, 0x48},
	{0xc3, 0x5a},
	{0xc4, 0x6b},
	{0xc5, 0x7b},
	{0xc6, 0x95},
	{0xc7, 0xab},
	{0xc8, 0xbf},
	{0xc9, 0xcd},
	{0xca, 0xd9},
	{0xcb, 0xe3},
	{0xcc, 0xeb},
	{0xcd, 0xf7},
	{0xce, 0xfd},
	{0xcf, 0xff},
		///Y gamma
	{0xfe, 0x00},
	{0x63, 0x00},
	{0x64, 0x05},
	{0x65, 0x0c},
	{0x66, 0x1a},
	{0x67, 0x29},
	{0x68, 0x39},
	{0x69, 0x4b},
	{0x6a, 0x5e},
	{0x6b, 0x82},
	{0x6c, 0xa4},
	{0x6d, 0xc5},
	{0x6e, 0xe5},
	{0x6f, 0xFF},
		//////ASDE
	{0xfe, 0x01},
	{0x18, 0x02},
	{0xfe, 0x00},
	{0x98, 0x00},
	{0x9b, 0x20},
	{0x9c, 0x80},
	{0xa4, 0x10},
	{0xa8, 0xB0},
	{0xaa, 0x40},
	{0xa2, 0x23},
	{0xad, 0x01},
		//////////////////////////////////////////////
		////////// AEC	  ////////////////////////
		//////////////////////////////////////////////
	{0xfe, 0x01},
	{0x9c, 0x02},
	{0x08, 0xa0},
	{0x09, 0xe8},
	{0x10, 0x00},
	{0x11, 0x11},
	{0x12, 0x10},
	{0x13, 0x80},	 ///  lanking +2
	{0x15, 0xfc},
	{0x18, 0x03},
	{0x21, 0xc0},
	{0x22, 0x60},
	{0x23, 0x30},
	{0x25, 0x00},
	{0x24, 0x14},
		//////////////////////////////////////
		////////////LSC//////////////////////
		//////////////////////////////////////
	{0xfe, 0x01},
	{0xc0, 0x10},
	{0xc1, 0x0c},
	{0xc2, 0x0a},
	{0xc6, 0x0e},
	{0xc7, 0x0b},
	{0xc8, 0x0a},
	{0xba, 0x26},
	{0xbb, 0x1c},
	{0xbc, 0x1d},
	{0xb4, 0x23},
	{0xb5, 0x1c},
	{0xb6, 0x1a},
	{0xc3, 0x00},
	{0xc4, 0x00},
	{0xc5, 0x00},
	{0xc9, 0x00},
	{0xca, 0x00},
	{0xcb, 0x00},
	{0xbd, 0x00},
	{0xbe, 0x00},
	{0xbf, 0x00},
	{0xb7, 0x07},
	{0xb8, 0x05},
	{0xb9, 0x05},
	{0xa8, 0x07},
	{0xa9, 0x06},
	{0xaa, 0x00},
	{0xab, 0x04},
	{0xac, 0x00},
	{0xad, 0x02},
	{0xae, 0x0d},
	{0xaf, 0x05},
	{0xb0, 0x00},
	{0xb1, 0x07},
	{0xb2, 0x03},
	{0xb3, 0x00},
	{0xa4, 0x00},
	{0xa5, 0x00},
	{0xa6, 0x00},
	{0xa7, 0x00},
	{0xa1, 0x3c},
	{0xa2, 0x50},
	{0xfe, 0x00},
	{0xB1, 0x04},
	{0xB2, 0xfd},
	{0xB3, 0xfc},
	{0xB4, 0xf0},
	{0xB5, 0x05},
	{0xB6, 0xf0},
	{0xfe, 0x00},
	{0x27, 0xf7},
	{0x28, 0x7F},
	{0x29, 0x20},
	{0x33, 0x20},
	{0x34, 0x20},
	{0x35, 0x20},
	{0x36, 0x20},
	{0x32, 0x08},
	{0x47, 0x00},
	{0x48, 0x00},
	{0xfe, 0x01},
	{0x79, 0x00},
	{0x7d, 0x00},
	{0x50, 0x88},
	{0x5b, 0x0c},
	{0x76, 0x8f},
	{0x80, 0x70},
	{0x81, 0x70},
	{0x82, 0xb0},
	{0x70, 0xff},
	{0x71, 0x00},
	{0x72, 0x28},
	{0x73, 0x0b},
	{0x74, 0x0b},
	{0xfe, 0x00},
	{0x70, 0x45},
	{0x4f, 0x01},
	{0xf1, 0x07},
	{0xf2, 0x01},

#if 0 //1/2 subsample
	{0xfe, 0x00},
	{0x59, 0x22},
	{0x5a, 0x0e},
	{0x5b, 0x00},
	{0x5c, 0x00},
	{0x5d, 0x00},
	{0x5e, 0x00},
	{0x5f, 0x00},
	{0x60, 0x00},
	{0x61, 0x00},
	{0x62, 0x00},

	//crop 320*240
	{0x50, 0x01},
	{0x51, 0x00},
	{0x52, 0x00},
	{0x53, 0x00},
	{0x54, 0x00},
	{0x55, 0x00},
	{0x56, 0xf0},
	{0x57, 0x01},
	{0x58, 0x40},
#endif

};
#endif
#endif

